package com.qf.bank.common.utils;

import cn.hutool.extra.qrcode.QrCodeUtil;
import cn.hutool.extra.qrcode.QrConfig;
import org.springframework.util.ResourceUtils;

import java.io.FileNotFoundException;

/**
 * @author 惠佳旭
 * @date 2019/12/5
 */
public class QrCodeUtils {

  public static byte[] getQrCode(String content) {
    QrConfig qrConfig = new QrConfig(300, 300);
    try {
      qrConfig.setImg(ResourceUtils.getFile("classpath:static/img/logo.png"));
      return QrCodeUtil.generatePng(content, qrConfig);
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    }
    return null;
  }
}
